Recent Backupsから日時・ページ数・リンク数を抽出する
https://scrapbox.io/projects/${projectName}/settings/backup を開いて実行する
code:js
(() => {
// scrapbox.io/projects/${projectName}/settings/backup
class BackupRecord {
constructor({ date, time, pageCount, linkCount }) {
this.date = date;
this.time = time;
this.pageCount = pageCount;
this.linkCount = linkCount;
}
toString() {
}
}
const openAllBackupRecords = () => {
document.querySelectorAll(".group-label").forEach((elem) => {
const open = elem.querySelector("span.open");
if (open) return;
elem.click();
});
};
const readRecords = () => {
const records = [];
document.querySelectorAll(".backup-item").forEach((backupItem) => {
const label = backupItem.querySelector("label").innerText;
const helpBlock = backupItem.querySelector(".help-block").innerText;
// bookmarkleterが??に対応していない
records.push(new BackupRecord({ date, time, pageCount, linkCount }));
});
return records;
};
const print = (body) => {
const url = URL.createObjectURL(
type: "text/plain",
})
);
window.open(url);
};
const printRecords = (records) => {
print(records.map((record) => record.toString()).join("\n"));
};
const main = () => {
openAllBackupRecords();
const records = readRecords();
printRecords(records);
};
main();
})();